<!doctype html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="__public__/static/css/normalize.css">
    <link rel="stylesheet" href="__static__/css/style.css">
    <script src="__public__/static/js/jquery-2.2.0.min.js"></script>
    <title>数字串串乐</title>

</head>
<body>
<section class="warp">
    <div id="test">
        {volist name="data" id="vo"}
        <a href="javascript:;">{$vo}</a>
        {/volist}

    </div>
</section>
</body>
<script>
    // var URL = 'http://youxi.cc:9908/index.php/';
    var URL = ' http://strong.4kb.cn/index.php/';
    var oDiv = document.getElementById('test');

    var oA = oDiv.getElementsByTagName('a');
    for (let i = 0; i < oA.length; i++) {
        oA[i].onclick = function () {

            var id = this.innerHTML;

            $.ajax({
                type: 'POST',
                url: URL + 'index/index/ajax',
                data: {id: id},
                dataType: "json",
                success: function (data) {
                    if (data == 1) {
                        oA[i].className = 'active'
                    } else {
                        alert('请选择对应的数字');
                    }
                }
            });

        }
    }

</script>
</html>